import axios from 'axios';

let base = '/meeting';

export const requestLogin = params => { return axios.post(`${base}/login`, params).then(res => res.data); };

export const requestAdminLogin = params => { return axios.post(`${base}/login`, params).then(res => res.data); };

export const batchRemoveUser = params => { return axios.get(`${base}/user/batchremove`, { params: params }); };

export const getRoomList = params => { return axios.post(`${base}/room/list`, params).then(res => res.data); };

export const addRoom = params => { return axios.post(`${base}/room/addRoom`,  params).then(res => res.data); };

export const removeRoom = params => { return axios.get(`${base}/room/removeRoom`, { params: params }) };

export const editRoom = params => { return axios.post(`${base}/room/editRoom`, params).then(res => res.data); };

export const getEquipList = params => { return axios.post(`${base}/equip/list`, { params: params }); };

export const addEquip = params => { return axios.post(`${base}/equip/addEquip`,  params).then(res => res.data); };

export const removeEquip = params => { return axios.post(`${base}/equip/removeEquip`, params).then(res => res.data); };

export const editEquip = params => { return axios.post(`${base}/equip/editEquip`, params).then(res => res.data); };

export const getUserList = params => { return axios.post(`${base}/user/list`, { params: params }); };

export const addUser = params => { return axios.post(`${base}/user/addUser`,  params).then(res => res.data); };

export const removeUser = params => { return axios.post(`${base}/uesr/removeUser`, params).then(res => res.data); };

export const editUser = params => { return axios.post(`${base}/user/editUser`, params).then(res => res.data); };

// 前台
export const getRoomDetailsList = params => { return axios.post(`${base}/book/getBookDetailByQuery`,params).then(res => res.data); };

export const getApplyRoomList = params => { return axios.post(`${base}/room/list`, params).then(res => res.data); };

//申请预约界面 根据 会议室ID查询设备 路径
export const getApplyEquipsList = roomId => { return axios.get(`${base}/applyEquip/applyEquiplist?roomId=${roomId}`).then(res => res.data); };

//申请预约界面 根据 用户ID查询部门 路径
//export const getDepartmentList = params => { return axios.get(`${base}/user/getDepartment`, params).then(res => res.data); };
export const getDepartmentList = userId => { return axios.get(`${base}/user/getDepartment?userId=${userId}`).then(res => res.data); };

export const getAppointmentDetailsList = id => { return axios.get(`${base}/book/getMyBookDetail?id=${id}`).then(res => res.data); };

//export const getDepartmentList = userId => { return axios.get(`${base}/user/getDepartment?userId=${userId}`).then(res => res.data); };

//submitFormList
export const submitFormList = params => { return axios.post(`${base}/book/bookMeetingRoom`,params).then(res => res.data); };

